package service.customer;

import java.util.List;
import dao.CustomerDAO;
import dao.RecordDuplicateException;
import entities.Customer;


public class CustomerServiceInMemory implements CustomerService{

	public CustomerServiceInMemory(){
		
	}
	
	public static CustomerService newInstance(){
		return new CustomerServiceInMemory();
	}
	
	/**
	 * Finds a customer based on the customer id.
	 * @param userid - user id
	 * @return the instance of the customer
	 */
	public Customer findCustomer(String username){
		CustomerDAO db = CustomerDAO.getInstance();
		Customer result = null;
		result = db.findCustomer(username);
		return result;
	}
	
	
	/**
	 * Adds a new customer to the system.
	 * @param obj - the customer instance to add
	 */
	
	public void addCustomer(Customer obj) throws RecordDuplicateException{
		CustomerDAO db = CustomerDAO.getInstance();	
		db.addCustomer(obj);
		return;
	}
	
	public List<Customer> customersList(){
		CustomerDAO db = CustomerDAO.getInstance();
		return db.getListCustomers();
	}

	public void removeCustomer(Customer obj) {
		// TODO Auto-generated method stub
		
	}

	public void setCustomer(Customer obj) {
		// TODO Auto-generated method stub
		
	}
}
